package com.ebt.m.proposal_v2.utils;

import android.content.Context;
import android.content.SharedPreferences;

import com.ebt.m.AppContext;

public class SharePrefrenceUtils {
    private static final String NAME = "PROPOSAL_TIP";
    private SharedPreferences sharedPreferences;
    private SharedPreferences.Editor editor;

    private SharePrefrenceUtils() {
        sharedPreferences = AppContext.getInstance().getSharedPreferences(NAME, Context.MODE_PRIVATE);
        editor = sharedPreferences.edit();
    }

    private static SharePrefrenceUtils instance;

    public static SharePrefrenceUtils getDefault() {
        if (instance == null) {
            synchronized (SharePrefrenceUtils.class) {
                if (instance == null) {
                    instance = new SharePrefrenceUtils();
                }
            }
        }
        return instance;
    }

    public boolean getBoolean(String key, boolean defaultValue) {
        return sharedPreferences.getBoolean(key, defaultValue);
    }

    public void putBoolean(String key, boolean value) {
        editor.putBoolean(key, value).commit();
    }

}
